<?php
namespace WebUtil\Matrix;

use WebUtil\Matrix\Layer\ArrayUtilLayer;

class Transform
{

    public static function instance(){
        return new static();
    }
    public function process(...$layers)
    {
        $input = null;
        foreach ($layers as $layer){
            if (is_array($layer)){
                $input = [];
                foreach ($layer as $k => $subLayer){
                    $input[$k] = $subLayer->transform($input);
                }
            }else{
                $input = $layer->transform($input);
            }
        }
        return $input;
    }


    public function first()
    {
        return new ArrayUtilLayer('first');
    }
}